﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Babylon.Toolbox
{
    public struct ParticleVertex
    {
        // Stores which corner of the particle quad this vertex represents.
        public Vector2 Corner;

        // Stores the starting position of the particle.
        public Vector3 InitialPosition;

        // Stores the starting velocity of the particle.
        public Vector3 InitialVelocity;

        // Four random values, used to make each particle look slightly different.
        public Vector4 Random;

        // The time (in seconds) at which this particle was created.
        public float StartTime;


        // Describe the layout of this vertex structure.
        public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
        (
            new VertexElement(0, VertexElementFormat.Vector2,
                                 VertexElementUsage.Position, 0),

            new VertexElement(2 * (sizeof(float)), VertexElementFormat.Vector3,
                                 VertexElementUsage.Position, 1),

            new VertexElement((2 + 3) * (sizeof(float)), VertexElementFormat.Vector3,
                                  VertexElementUsage.Normal, 0),

            new VertexElement((2 + 3 + 3) * (sizeof(float)), VertexElementFormat.Vector4,
                                  VertexElementUsage.TextureCoordinate, 0),

            new VertexElement((2 + 3 + 3 + 4) * (sizeof(float)), VertexElementFormat.Single,
                                  VertexElementUsage.TextureCoordinate, 1)
        );


    }
}
